import { _decorator, Component, Label, Node } from 'cc';
import { Skill } from '../entity/Skill';
import { UIManager } from '../common/UIManager';
import { PrefabEnum } from '../common/PrefabEnum';
import { NumberStrList } from '../entity/Hero';
const { ccclass, property } = _decorator;

@ccclass('SkillDesc')
export class SkillDesc extends Component {
    @property(Node)
    mask:Node
    @property(Node)
    close:Node
    @property(Label)
    skillName:Label
    @property(Label)
    advance:Label
    @property(Label)
    desc:Label

    
    start() {
        this.close.on(Node.EventType.TOUCH_END, this.onClose, this)
        this.mask.on(Node.EventType.TOUCH_END, this.onClose, this)
    }

    setData(skill:Skill, ad:number){
        this.skillName.string = skill.name
        this.desc.string = skill.desc
        this.advance.string = NumberStrList[ad] + '阶技能'
    }

    onClose(){
        UIManager.instance.closeUI(PrefabEnum.SkillDesc)
    }
}


